package AbstractFactoryType.src;

import java.util.concurrent.*;

/**
 * @author SUN YE
 * @Title: test
 * @Package PACKAGE_NAME
 * @Description:线程池的测试，与设计模式无关
 * @date 2022-07-31
 */
public class ThreadTest {
    private static  final ScheduledExecutorService executorService = Executors.newSingleThreadScheduledExecutor();
    static {
        init();
        executorService.scheduleWithFixedDelay(ThreadTest::init,50,50,TimeUnit.MILLISECONDS);
        Runtime.getRuntime().addShutdownHook(new Thread(executorService::shutdown));
    }
    public static void main(String[] args) {
        System.out.println("hello world");
    }
    public static   void init() {
        System.out.println("hello world");
    }
}
